import { UserState } from "./userReducer";

// 常量
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS';
export const LOGIN_QUIT = 'LOGIN_QUIT'
// 登录成功 action
interface LoginSuccessAction {
	type: typeof LOGIN_SUCCESS
	payload: UserState
}

// 登录成功
export function loginSuccessActionCreator(payload: UserState): LoginSuccessAction {
	return { type: LOGIN_SUCCESS, payload }
}

interface LoginQuitAction {
	type: typeof LOGIN_QUIT
}

export function LoginQuitActionCreator(): LoginQuitAction {
	return { type: LOGIN_QUIT }
}


// 用户 action
export type UserAction = LoginSuccessAction | LoginQuitAction